function backWriteExpression(expressionObj) {
    $("#expressionIndex").val(expressionObj.length);
    var id =0;
    expressionObj.forEach(function (v) {
        var div="<div id=\""+id+"\">";
        div +="<input type='text' value='"+v+"' class='form-control' placeholder ='表达式'/>";
        div +="<a onclick='deleteExpression("+id+")'><img src='/images/delete.png'></img></a>";
        div +="</div>";
        $("#expressionDiv").append(div);
        id++;
    })
}

function switchExpression(value) {
    if(value ==1){
        $("#expressionBtn").hide();
    }else {
        $("#expressionBtn").show();
    }
}
function writeExpression() {
    var expressions=$("#expressionDiv input");
    var expressionsValue=[];
    for(var i =0;i<expressions.length;i++){
        var input =  expressions[i];
        expressionsValue.push(input.value)
    }
    $("#expression").val(JSON.stringify(expressionsValue));
}
function addExpression() {
    var id =$("#expressionIndex").val();
    var div="<div id=\""+id+"\">";
    div +="<input type='text' class='form-control' placeholder ='表达式'/>";
    div +="<a onclick='deleteExpression("+id+")'><img src='/images/delete.png'></img></a>";
    div +="</div>";
    $("#expressionDiv").append(div);
    $("#expressionIndex").val(parseInt(id)+1);
}
function deleteExpression(id) {
    $("#"+id).remove();
}